const cates = [
    { cid: 1, pid: 0, name: '首页' },
    { cid: 2, pid: 0, name: '学校概况' },
    { cid: 8, pid: 2, name: '学校简介' },
    { cid: 9, pid: 2, name: '现任领导' },
    { cid: 10, pid: 2, name: '历任领导' },
    { cid: 11, pid: 2, name: '民大标识' },
    { cid: 12, pid: 2, name: '民大校训' },
    { cid: 13, pid: 2, name: '民大校歌' },
    { cid: 14, pid: 2, name: '校园风景' },
    { cid: 15, pid: 2, name: '学校地图' },
    { cid: 16, pid: 2, name: '校史沿革' },
    { cid: 17, pid: 0, name: '机构设置' },
    { cid: 18, pid: 17, name: '管理机构' },
    { cid: 19, pid: 17, name: '教学机构' },
    { cid: 20, pid: 17, name: '教辅机构' },
    { cid: 21, pid: 17, name: '服务机构' },
    { cid: 22, pid: 17, name: '直属机构' },
    { cid: 4, pid: 0, name: '师资队伍' },
    { cid: 5, pid: 0, name: '学科专业' },
    { cid: 6, pid: 0, name: '科学研究' },
    { cid: 7, pid: 0, name: '招生就业' },
    { cid: 6, pid: 0, name: '合作交流' },
    { cid: 7, pid: 0, name: '校友会' },			  
];
var indexCates = channelCates(cates);
console.log(indexCates);
//组合html结构
if(indexCates){
    var str = '';
    indexCates.forEach(function(val,index,arr){
        str+='<li>';
        str+='<a href="list.html" class="exception">'+val.name+'</a>';
        //二级分类
        if(val.children&&val.children.length>0){
            str+='<ul class="navbar_lmt_second">';
            //二级菜单又要循环了
            val.children.forEach(function(xval,xindex,xarr){
                str+='<li><a href="">'+xval.name+'</a></li>';
            });
            str+='</ul>';
        }
        str+='</li>';
    });
    // alert(str);
    document.querySelector('.nav_real_lmt').innerHTML=str;
}